home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-05-03 | 5.5 KB | 170 lines | [TEXT/MPS ] |
- /*
- FILENAME
- CommonDefines.h
-
- DESCRIPTION
- Contains defines and prototypes used by more than one .r or .h file.
-
- COPYRIGHT
- Copyright © 1995 Apple Computer, Inc.
- All rights reserved.
-
- Modification history
- 05/03/95 - Dave Hersey - Version 1.0.1 to fix some minor bugs in
- CustomBufferingAndIO.c.
-
- 01/14/95 - Dave Hersey - Created from the shell of a hollowed-out
- ImageWriter driver.
-
- NOTE: Relevant goodies are listed in MPW's "Mark" menu.
-
- */
-
-
- // Driver info
- #define DriverName "CustomWriter GX"
- #define DriverCreator 'cuWR'
- #define DriverType 'pdvr'
-
- // Code segment info-- all driver overrides go in 'pdvr' resources;
- // these are the IDs we use for ours.
- #define NewSegID 0
- #define OldSegID 1
-
- // The creator and type of the files we create. (SimpleText PICTs)
- #define kFileCreator 'ttxt'
- #define kFileType 'PICT'
-
- // Status defines
- #define kTransmissionStatID gxPrintingDriverBaseID // stat resource ID
- #define kSendingPartStatIdx 1 // item number for sending data
- #define kPreparingPartStatIdx 2 // item number for preparing data
- #define kPrintingPageStatIdx 3 // item number for writing page
-
- // Chooser initialize message selector (wasn't in pre-ETO 16 headers).
- #define initializeMsg 11
-
- // Resource ID for icon that we show in the Chooser's device list.
- #define r_ChooserIcon 1000
-
- // The number and size of our custom buffers.
- #define kOurBufferSize (20 *1024)
- #define kNumBuffs (4)
-
- // Defines used by the old-application compatibility code.
- #define kPortrait (0x04)
- #define kPrintRecordVers (12)
- #define kDriverWDev (0x8800)
-
- // do the following only if we aren't running in Rez
- #ifndef REZ
-
- #include <Devices.h>
- #include <Errors.h>
- #include <FixMath.h>
- #include <Folders.h>
- #include <Font Library.h>
- #include <Fonts.h>
- #include <Graphics Libraries.h>
- #include <Graphics Routines.h>
- #include <GXExceptions.h>
- #include <Layout Routines.h>
- #include <Lists.h>
- #include <LowMem.h>
- #include <Memory.h>
- #include <PrintingDrivers.h>
- #include <PrintingLibraries.h>
- #include <PrintingManager.h>
- #include <PrintingMessages.h>
- #include <Math Routines.h>
- #include <Math Types.h>
- #include <QuickDraw.h>
- #include <Resources.h>
- #include <Script.h>
- #include <StandardFile.h>
- #include <ToolUtils.h>
- #include <Types.h>
-
- // Our global data structure
-
- typedef struct
- {
- long lineFeeds; // accumulated lines feeds
- FSSpec fileLocation; // Where to put our files.
- short curFileRefNum; // refNum of current open file.
- long pagesImaged; // Number of pages imaged.
- long lastYPos; // Used by our RasterDatIn override.
- Rect pixMapBounds; // Bounds of the pixmap we create.
- short pixMapRowBytes; // rowBytes of the pixmap we create.
- Fixed hRes; // Horizontal output resolution.
- Fixed vRes; // Vertical output resolution.
- } DriverGlobals, *DriverGlobalsPtr, **DriverGlobalsHdl;
-
-
- // Our buffer description
-
- typedef struct
- {
- Boolean bufferIsDirty; // Is this buffer dirty (is there data to be written out)?
- long curOffset; // where's the next byte go in this buffer?
- gxPrintingBuffer printBuffer; // The buffer itself.
- char xData[kOurBufferSize -1]; // the printBuffer's data. (access it through
- // the printBuffer field)
- } BufferEntry, *BufferEntryPtr, **BufferEntryHdl;
-
-
- // our buffer group description-- a collection of BufferEntry records plus info.
-
- typedef struct
- {
- short numBuffers; // number of buffers
- long bufferSize; // and their sizes.
- short curBuff; // current buffer we're writing to.
- BufferEntry buff[1]; // individual buffer records.
- } BufferGroup, *BufferGroupPtr, **BufferGroupHdl;
-
-
- // Routines to save and retrieve our jump table globals. These
- // routines are in NewApp.a
-
- extern void SetDriverGlobals(DriverGlobalsHdl theGlobals);
- extern DriverGlobalsHdl GetDriverGlobals(void);
-
- // Our prototypes in alphabetical order.
-
- OSErr CreateAndStoreGlobals(DriverGlobalsHdl *driverGlobalsHdl);
- OSErr CreateBuffers(void);
- pascal OSErr Device(short message, short caller, StringPtr objName,
- StringPtr zoneName, ListHandle theList, long p2);
- OSErr DisposeBuffers(void);
- void DisposeGlobals(void);
- OSErr FlushBuffers(BufferGroupHdl buffGrpHdl);
- pascal void LDEF(short message, Boolean select, Rect *theRect,
- Cell theCell, short dataOffset, short dataLen, ListHandle theList);
- OSErr SD_BufferData(Ptr data, long length, long bufferOptions);
- OSErr SD_ChooserMessage(short message, short caller, StringPtr objName,
- StringPtr zoneName, ListHandle theList, long p2);
- void SD_CleanupOpenConnection(void);
- OSErr SD_CloseConnection(void);
- OSErr SD_ConvertPrintRecordFrom(gxUniversalPrintRecordHdl huPrint);
- OSErr SD_ConvertPrintRecordTo(THPrint hoPrint);
- OSErr SD_DefaultDesktopPrinter(Str31 dtpName);
- OSErr SD_DumpBuffer(gxPrintingBuffer *theBuffer);
- OSErr SD_FinishSendPage(void);
- OSErr SD_FreeBuffer(gxPrintingBuffer *theBuffer);
- OSErr SD_ImageJob(gxSpoolFile theSpoolFile, long *closeOptions);
- OSErr SD_OpenConnection(void);
- OSErr SD_PrValidate(THPrint hPrint, Boolean *wasChanged);
- OSErr SD_RasterDataIn (gxOffscreenHdl hOffscreen, gxRectangle *bandRect, gxRectangle *dirtyRect);
- OSErr SD_SetupImageData(gxRasterImageDataHdl hImageData);
- OSErr SD_StartSendPage(gxFormat pageFormat);
- OSErr SD_WriteData(Ptr data, long length);
- OSErr UpdatePrintRecord(THPrint hPrint);
- OSErr WriteBlankLines(long numBlankLinesToDo, gxRectangle *bandRect);
- OSErr WriteEndOfPICTFile(void);
- OSErr WriteStartOfPICTFile(void);
- OSErr WriteRawData(void *dataBuffer, long dataLength);
-
- #endif REZ
-
-